package HospitalSystem.src;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.ArrayList;

public class Doctor {
    private static int num = 2300;
    private int DoctorId;
    private String name;
    private char sex;
    private int age;
    private String specialty; //主治方向
    private LocalDate joinDate; //入职时间
    private String introduce;
    private ArrayList<Schedule> ScheduleList = new ArrayList<>();  //预约表
    public Doctor() {
        num++;
        DoctorId = num;
        //自动创建预约表
        LocalDate ldt = LocalDate.now();
        ArrayList<Schedule> schedules = new ArrayList<>();
        for (int i = 0; i < 7; i++) {
            Schedule ds = new Schedule(ldt.plusDays(i),5,5);
            schedules.add(ds);
        }
        this.setScheduleList(schedules);

    }

    public Doctor( String name, char sex, int age, String specialty,String introduce) {
        this();
        this.name = name;
        this.sex = sex;
        this.age = age;
        this.specialty = specialty;
        this.introduce = introduce;
        this.joinDate =  LocalDate.now();
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public  int getDoctorId() {
        return DoctorId;
    }

    public  void setDoctorId(int doctorId) {
        DoctorId = doctorId;
    }

    public char getSex() {
        return sex;
    }

    public void setSex(char sex) {
        this.sex = sex;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getIntroduce() {
        return introduce;
    }

    public void setIntroduce(String introduce) {
        this.introduce = introduce;
    }

    public String getSpecialty() {
        return specialty;
    }

    public void setSpecialty(String specialty) {
        this.specialty = specialty;
    }

    public LocalDate getJoinDate() {
        return joinDate;
    }

    public void setJoinDate(LocalDate joinDate) {
        this.joinDate = joinDate;
    }

    public ArrayList<Schedule> getScheduleList() {
        return ScheduleList;
    }

    public void setScheduleList(ArrayList<Schedule> scheduleList) {
        ScheduleList = scheduleList;
    }
    public void showScheduleList() {
        System.out.println(this.name + " \t 主任医生");
        System.out.println("擅长：" + this.introduce);
        for (int i = 0; i < ScheduleList.size(); i++) {
            System.out.print(ScheduleList.get(i).getDate().getDayOfMonth());
            System.out.print(",上午 剩余号源："  +  ScheduleList.get(i).getAmNum());
            System.out.println(",下午 剩余号源："  +  ScheduleList.get(i).getPmNum());
        }
    }
    public void showScheduleFromDate(LocalDate date) {
        System.out.println(this.name + " \t 主任医生");
        System.out.println("擅长：" + this.introduce);
        for (int i = 0; i <ScheduleList.size(); i++) {
            if(ScheduleList.get(i).getDate().equals(date)) {
                System.out.print(date.getDayOfMonth() + "这天的号源");
                System.out.print(",上午 剩余号源：" + ScheduleList.get(i).getAmNum());
                System.out.println(",下午 剩余号源：" + ScheduleList.get(i).getPmNum());
                break;
            }
        }
    }
}
